/**
 *  This file is part of AugeasWH.
 *
 *  AugeasWH. is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  AugeasWH. is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with AugeasWH.  If not, see <http://www.gnu.org/licenses/>.
 */


package cz.fit.vutbr.pis2012.augeaswh.control.ekonom.discounts;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import org.richfaces.component.SortOrder;

@ManagedBean
@ViewScoped
public class DiscountsSortingBean implements Serializable
{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3027010707153023862L;
	
	private SortOrder timeOrder = SortOrder.unsorted;
	private SortOrder discountOrder = SortOrder.unsorted;
	private SortOrder discountTypeOrder = SortOrder.unsorted;
	private SortOrder stockTypeOrder = SortOrder.unsorted;
	
		

	public void sortByStockType() 
	{
		timeOrder = SortOrder.unsorted;
		discountOrder = SortOrder.unsorted;
		discountTypeOrder= SortOrder.unsorted;
		setTimeOrder((getStockTypeOrder().equals(SortOrder.ascending)) ? SortOrder.descending : SortOrder.ascending);
	}

	public void sortByTime() 
	{
		stockTypeOrder = SortOrder.unsorted;
		discountOrder = SortOrder.unsorted;
		discountTypeOrder= SortOrder.unsorted;
		setTimeOrder((getTimeOrder().equals(SortOrder.ascending)) ? SortOrder.descending : SortOrder.ascending);
	}

	public void sortByDiscount()
	{
		timeOrder = SortOrder.unsorted;
		discountTypeOrder = SortOrder.unsorted;
		discountTypeOrder = SortOrder.unsorted;
		setdiscountOrder((getdiscountOrder().equals(SortOrder.ascending)) ? SortOrder.descending : SortOrder.ascending);
	}

	public void sortByDiscountType() 
	{
		timeOrder = SortOrder.unsorted;
		discountOrder = SortOrder.unsorted;
		discountTypeOrder = SortOrder.unsorted;
		setdiscountTypeOrder((getdiscountTypeOrder().equals(SortOrder.ascending)) ? SortOrder.descending : SortOrder.ascending);
	}

	public SortOrder getTimeOrder() 
	{
		return timeOrder;
	}

	public void setTimeOrder(SortOrder timeOrder) 
	{
		this.timeOrder = timeOrder;
	}
	
	public SortOrder getdiscountOrder() 
	{
		return discountOrder;
	}

	public void setdiscountOrder(SortOrder discountOrder) 
	{
		this.discountOrder = discountOrder;
	}

	public SortOrder getdiscountTypeOrder() 
	{
		return discountTypeOrder;
	}

	public void setdiscountTypeOrder(SortOrder discountTypeOrder) 
	{
		this.discountTypeOrder = discountTypeOrder;
	}
	
	public SortOrder getStockTypeOrder() {
		return stockTypeOrder;
	}

	public void setStockTypeOrder(SortOrder stockTypeOrder) {
		this.stockTypeOrder = stockTypeOrder;
	}

}
